package demo1;



public class Test {
    /*public static void main(String[] args) {
        String str = "Hello";
        System.out.println(str.toLowerCase());
        System.out.println(str.toUpperCase());

        String str2 = new String("hello world");

        char[] str3 = {'h','e','l','l','o'};
        String str4 = new String(str3);

        System.out.println(str4);
        for(char ch : str3) {
            System.out.println(ch);
        }
    }*/

    /*public static void main(String[] args) {
        String str1 = "hello";
        String str2 = "world";
        String str3 = new String(str1);
        String str4 = str1;

        if (str1 == str4) {
            System.out.println("地址");
        }
        if (str1.equals(str3)) {
            System.out.println("数值");
        }

        System.out.println(str1.isEmpty());//如果字符串为0，返回true，否则返回false
        System.out.println(str1.length());

    }*/

    /*public static void main(String[] args) {
        String str1 = new String("abcd");
        String str2 = new String("abfh");
        String str3 = new String("abcd");

        System.out.println(str1.compareTo(str2));//返回差值
        System.out.println(str1.compareTo(str3));

        String str4 = new String("ABGsadn");
        String str5 = new String("abgsadn");
        System.out.println(str4.compareToIgnoreCase(str5));//忽略大小写比较
    }*/

    public static void main(String[] args) {
        String s = "abcdef";
        System.out.println(s.charAt(5));//返回5下标的字符
        System.out.println(s.indexOf("cd"));//返回cd的下标 2
    }

}
